﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="New.aspx.cs"
    Inherits="FisheryPlatform.Web.Admin.Posts.New" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagName="Style" TagPrefix="Menu" Src="~/Modules/Menu/StyleMenu.ascx" %>
<%@ Register TagName="Left" TagPrefix="Menu" Src="~/Modules/Menu/LeftMenu.ascx" %>
<%@ Register TagName="Header" TagPrefix="Menu" Src="~/Modules/Menu/HeaderMenu.ascx" %>
<%@ Register TagName="Footer" TagPrefix="Menu" Src="~/Modules/Menu/FooterMenu.ascx" %>
<%@ Register TagName="Text" TagPrefix="HtmlEditor" Src="~/Modules/HtmlEditor.ascx" %>
<%@ Import Namespace="FisheryPlatform.Bussiness.Term" %>
<%@ Import Namespace="FisheryPlatform.Entity" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <Menu:Style runat="server" ID="menuStyle" Title="Hi"></Menu:Style>
    <link rel="stylesheet" type="text/css" media="all" href="<%=FisheryPlatform.SiteConfig.SiteConfigManager.WebSite.Css%>/PubCss/HtmlEditor.css" />
    <script type="text/javascript">
    if(<%=flag %>==1){
        alert("操作成功");
    }else if(<%=flag %>==0){
        alert("操作失败");
    }
    </script>
</head>
<body>
    <div class="wrapper">
        <Menu:Header runat="server" ID="menuHeader" />
        <div class="content">
            <Menu:Left runat="server" ID="menu_Left" />
            <div class="right">
                <div class="top">
                    文章管理>>文章发布</div>
                <div class="bottom">
                    <form id="form1" runat="server">
                    <input type="hidden" runat="server" id="txt_Cates" />
                    <input type="hidden" runat="server" id="txt_Tags" />
                    <input type="hidden" runat="server" id="txt_HotSettings" />
                    <div class="edit">
                        <dl>
                            <dt>标题：</dt><dd><input type="text" runat="server" id="txt_Title" size="50" class="txt_border txt_input1" /></dd>
                            <dt>内容：</dt><dd><HtmlEditor:Text runat="server" ID="hEditor_Content"></HtmlEditor:Text>
                            </dd>
                            <dt>分类：</dt><dd style="overflow: auto; _height: 25px; padding: 2px 2px 2px 5px; border: 1px solid #7F9DB9;
                                max-height: 150px; width: 400px;">
                                <ul style="padding: 0px">
                                    <% foreach (PostTermEntityForAjax cateInfo in TermManager.GetPostCateList())
                                       {%>
                                    <li style="list-style-type: none;">
                                        <%for (var i = 0; i < cateInfo.level; i++)
                                          { %>&nbsp;<%} %>
                                        <input type="checkbox" <%=GetCheckedStatus(cateInfo.id) %> id="chk_CateId_<%=cateInfo.id %>"
                                            value="<%=cateInfo.id %>" /><label for="chk_CateId_<%=cateInfo.id %>"><%= HttpUtility.HtmlEncode(cateInfo.name)%></label></li>
                                    <% }%>
                                </ul>
                            </dd>
                            <dt>标签：</dt><dd id="dd_Tags" style="padding: 2px 2px 2px 5px; border: 1px solid #7F9DB9;
                                overflow: auto; _height: 25px; max-height: 150px; width: 400px;">
                                <ul style="padding: 0px">
                                    <% foreach (PostTermEntityForAjax tagInfo in TermManager.GetPostTagList())
                                       {%>
                                    <li style="list-style-type: none; padding: 0px">
                                        <input type="checkbox" <%=GetCheckedStatus(tagInfo.id) %> id="chk_TagId_<%=tagInfo.id %>"
                                            value="<%=tagInfo.id %>" /><label for="chk_TagId_<%=tagInfo.id %>"><%= HttpUtility.HtmlEncode(tagInfo.name)%></label></li>
                                    <% }%></ul>
                            </dd>
                            <dt>状态：</dt><dd><select runat="server" id="sel_Status">
                                <option value="1">发布中</option>
                                <option value="3">草稿</option>
                                <option value="4">私有</option>
                                <option value="5">回收站</option>
                            </select></dd>
                            <dt>热门设置：</dt><dd>
                                <input type="checkbox" value="<%=OptionNameConstants.Posts_Home%>" id="chk_Hot_Home" /><label
                                    for="chk_Hot_Home">首页推荐</label>
                                <input type="checkbox" value="<%=OptionNameConstants.Posts_Top %>" id="chk_Hot_Top" /><label
                                    for="chk_Hot_Top">列表置顶</label>
                            </dd>
                            <dt>&nbsp;</dt><dd><input type="button" value="更新" id="btn_Save" onclick="" /></dd>
                        </dl>
                    </div>
                    </form>
                </div>
            </div>
        </div>
        <Menu:Footer runat="server" ID="menuFooter" />
    </div>
</body>
</html>
<script type="text/javascript" src="<%=FisheryPlatform.SiteConfig.SiteConfigManager.WebSite.JS%>/Pub/20110725/HtmlEditor.js"></script>
<script type="text/javascript">
    (function () {
        InitialEditor(jDoc("hEditor_Content_txt_Html").value);
        var hotList = jDoc("txt_HotSettings").value.split(',');
        for (var i = 0, len = hotList.length; i < len; i++) {
            if (hotList[i] != "") {
                CheckBox.selectedByProperty("form1", hotList[i], true, "value");
            }
        }
        function selectedCates() {
            jDoc("txt_Cates").value = CheckBox.getValueList("form1", [], "chk_CateId_").join(',');
        }
        function selectedTags() {
            jDoc("txt_Tags").value = CheckBox.getValueList("form1", [], "chk_TagId_").join(',');
        }
        function selectedHotSettings() {
            jDoc("txt_HotSettings").value = CheckBox.getValueList("form1", [], "chk_Hot_").join(',');
        }
        $(jDoc("btn_Save")).bind("click", function () {
            var title = jDoc("txt_Title");
            if (title.value.trim() == "") {
                alert("请输入标题");
                title.focus();
                return;
            }
            var contentText = jDoc("hEditor_Content_txt_Text");
            var contentHtml = jDoc("hEditor_Content_txt_Html");
            contentText.value = GetTextValue();
            contentHtml.value = GetHTMLValue();
            if (contentText.value.trim() == "") {
                alert("请输入内容");
                return;
            }
            selectedCates();
            selectedTags();
            selectedHotSettings();
            jDoc("form1").submit();
        });
    })();
</script>
